package com.example.moblie2021606143cwj0413;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private Button btnMainSupplier;
    private TextView tvMainTitle;
    private Button btnMainBuy;
    private TextView tvMainResult;
    private Button btnMainClose;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        btnMainClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AlertDialog dialog;
                dialog = new AlertDialog.Builder(MainActivity.this).setTitle("对话框").setMessage("真的要退出吗？？？")
                        .setIcon(R.mipmap.ic_launcher)
                        .setPositiveButton("确定", null)
                        .setNegativeButton("再等等", null)
                        .create();
                dialog.show();

            }

        });

            }


        private void initView() {
        btnMainSupplier = (Button) findViewById(R.id.btn_main_supplier);
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        btnMainBuy = (Button) findViewById(R.id.btn_main_buy);
        tvMainResult = (TextView) findViewById(R.id.tv_main_result);
        btnMainClose = (Button) findViewById(R.id.btn_main_close);
    }
}